<!DOCTYPE html>
<html lang="en" xmlns:th=www.thymeleaf.org>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
    <script src="https://cdn.bootcss.com/echarts/4.6.0/echarts.min.js"></script>
</head>
<body>
<div id="main" style="width: 600px;height:400px;">
</div>
<script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例
    $(function () {
        $.ajax({
            type:'get',
            url:"/echarts/list",
            dataType:"json",
            success: function (data) {
                var name =new Array();
                var count =new Array();

                $.each(data,function (index,info) {
                   name[index] = info.name;
                   count[index] = info.count;
               })
               console.log((data))
                // 基于准备好的dom，初始化echarts实例
                var myChart = echarts.init(document.getElementById('main'));

                // 指定图表的配置项和数据
                var option = {
                    title: {
                        text: '员工人数统计'
                    },
                    tooltip: {},
                    legend: {
                        data:['员工']
                    },
                    xAxis: {
                        data: name
                    },
                    yAxis: { type: 'value'},
                    series: [{
                        name: '人数',
                        type: 'bar',
                         data: count
                      //  data:data1
                    }]
                };

                // 使用刚指定的配置项和数据显示图表。
                myChart.setOption(option);
            }
        });
     });
</script>
</body>
</html>